#include <stdio.h>
#include <assert.h>

char* my_strcpy(char* arr1, const char* arr2)
//避免赋值表达式两端写反，用const定义arr2
//strcpy返回目标空间的起始地址，便于实现链式访问
{
    char* arr3 = arr1;
    assert(arr1 != NULL);//断言
    assert(arr2 != NULL);
    while(*arr1++ = *arr2++){;}
    return arr3;
}

int main()
{
    char arr1[20] = "XXXXXXXXXX";
    char arr2[] = "hello bit!";
    printf("%s\n", my_strcpy(arr1, arr2));
    return 0;
}

/*
const int num = 10;
int *p = &num;
*p = 20;
*/

//const定义的变量可通过指针绕路修改